﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RPGXEngine
{
    public class Command_Array : ICommand
    {
        #region ICommand Members

        public bool IsReturn { get { return false; } }
        public bool IsIf { get { return false; } }

        public List<ICommand> ChildrenCommands
        {
            get
            {
                return this._childrenCommands;
            }
        }
        private List<ICommand> _childrenCommands = new List<ICommand>();

        public IVariableType Execute(ScriptManager sm, FunctionScope scope)
        {
            ArrayVariableType v = new ArrayVariableType(String.Empty);

            List<IVariableType> vars = new List<IVariableType>();

            foreach (var cmd in this.ChildrenCommands)
            {
                vars.Add(cmd.Execute(sm, scope));
            }

            v.Value = vars;

            return v;
        }

        #endregion
    }
}
